Skip to content

chore(ci): report web-app coverage to SonarCloud - #1001

Open
dmihalcik-virtru wants to merge 1 commit into
mainfrom
DSPX-3229-sonar-coverage
Open

chore(ci): report web-app coverage to SonarCloud#1001
dmihalcik-virtru wants to merge 1 commit into
mainfrom
DSPX-3229-sonar-coverage

Conversation

@dmihalcik-virtru

@dmihalcik-virtru dmihalcik-virtru commented Aug 20, 2026

Copy link
Copy Markdown
Member

Split out of #1000 to keep that PR to the demo-app change.

What

sonar.sources has listed web-app/src since the property file was written,
but sonar.javascript.lcov.reportPaths only ever pointed at lib/coverage.
Every file under web-app/src has therefore counted as uncovered, and adding
tests there could not change that.

  • web-app runs vitest with the v8 coverage provider and writes lcov
  • the scan moves out of the lib job into its own sonarscan job. It needs the
    report from the web-app job, and that job already needs: lib, so the scan
    could not stay where it was. Both jobs upload their lcov as a 1-day artifact
  • test files are excluded from analysis. They sit beside the code they cover
    under web-app/src, so otherwise they count as main source with no report
    behind them, and adding a test would lower the new-code ratio

What this does not do

It does not by itself clear the quality gate. App.tsx is the bulk of the new
code in any web-app change and stays at 0%: App.test.tsx drives it through a
real browser against vite preview, so it executes in a process the v8 provider
never instruments. Crediting App.tsx needs either more pure logic extracted
into unit-testable modules, or browser-coverage collection wired into lcov.

Worth a separate conversation whether a demo app belongs in the SDK's quality
gate at all.

Risk

This touches build flow.

  • build-and-test / sonarscan is a new check. If branch protection lists
    required checks by name, it may need adding
  • the SonarCloud Scan step is gone from build-and-test / lib, and lib no
    longer does a full-history checkout, since it was only fetching depth 0 for
    sonar's benefit
  • sonarscan is in ci.needs, so a failed scan still fails CI exactly as it
    did when the scan was a step of lib
  • steps are individually guarded with if: fromJSON(env.do_sonarscan) rather
    than the job, because job-level if cannot read env. On forks and
    dependabot runs every step skips and the job reports success

How to test

cd web-app && npm ci && npm test

Check web-app/coverage/lcov.info exists and has SF: records for the files
under web-app/src (App.tsx, session.ts, config.ts, ...). Expect near-zero
coverage on this branch: the only test here is the browser-driven App.test.tsx.

The first real unit-tested file, src/fileNames.ts, arrives with #1000; once
both are merged its lcov record should read 18/18 lines.

sonar.sources has listed web-app/src since the property file was written, but
sonar.javascript.lcov.reportPaths only ever pointed at lib/coverage. Every file
under web-app/src has therefore counted as uncovered, and adding tests there
could not change that.

web-app now runs vitest with the v8 coverage provider and writes lcov. The scan
moves out of the lib job into its own: it needs the report from the web-app
job, and that job already needs lib, so the scan could not stay where it was.
Both jobs upload their lcov as a short-lived artifact for it to collect.

The new job is in ci.needs so a failed scan still fails CI, as it did when the
scan was a step of lib. Its steps are individually guarded rather than the job,
because job-level if cannot read env; on forks and dependabot runs they all
skip and the job reports success.

Test files are excluded from analysis. They sit beside the code they cover
under web-app/src, so without that they would count as main source with no
report behind them, and adding a test would lower the new-code ratio.

This does not by itself clear the quality gate. App.tsx is the bulk of the new
code in any web-app change and stays at 0%: App.test.tsx drives it through a
real browser against vite preview, so it runs in a process the v8 provider
never instruments.

Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
@dmihalcik-virtru
dmihalcik-virtru requested review from a team as code owners August 20, 2026 21:46
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@dmihalcik-virtru, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

An organization admin can change what happens after included review limits in Billing.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f0c98da7-4695-45d5-8655-5b529555295c

📥 Commits

Reviewing files that changed from the base of the PR and between 690d3cb and 4b39ba2.

⛔ Files ignored due to path filters (1)
  • web-app/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • .github/workflows/reusable_build-and-test.yaml
  • sonar-project.properties
  • web-app/package.json
  • web-app/vitest.config.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant